@extends('layouts.'.getTheme())
@section('css')
<style type="text/css">
    .widget .row span{
      font-size: 15px;
      font-weight: bold;
    }
    .p-md{
        padding-top: 6px;
        padding-bottom: 0px;
        margin-top: 0px;
        margin-bottom: 30px;
    }
    .m-b-md{
        padding-top: 3px;
    }
    .page-heading{
        padding-bottom: 2px;
    }
    .alert{
        /*padding-bottom: 0px;*/
        padding-left: 23px;
        padding-right: 23px;
        margin-bottom: 0px;
    }
    .alert p{
        font-size: 14px;
        font-weight: 12px;
    }
    .alert a{
        text-decoration: underline;
    }
    .canceled{
        margin: 0;
        padding: 0;
    }
</style>
@endsection
@section('content')
<div class="row wrapper border-bottom page-heading">
  <div class="col-sm-4">
      <h2>首页</h2>
<!--       <ol class="breadcrumb">
          <li>
              <a href="index.html">This is</a>
          </li>
          <li class="active">
              <strong>Breadcrumb</strong>
          </li>
      </ol> -->
  </div>
<!--   <div class="col-sm-8">
      <div class="title-action">
          <a href="" class="btn btn-primary">重新加载</a>
      </div>
  </div> -->

</div>
<div class="row wrapper border-bottom">
  <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <p>您好，欢迎您的到来！新型智能消防物联网系统V2.0开发采用Laravel：5.4.30，设计基于最小权限化管理(Any)，详情请参见<a href="{{url('admin/systemexp/develop')}}">开发说明</a>。已经进入正式的BUG测试中，如果使用中有什么BUG或需要优化，欢迎在下面的<i>系统反馈</i>中留言。v1.0版本请参见<a href="https://fire1.luckyye.com" target="_Blank">https://fire1.luckyye.com</a>
  </div>    
</div>

<div class="animated">
<div class="wrapper wrapper-content">
        <div class="row">
                    <div class="col-lg-3">
                    <div class="widget navy-bg p-md text-center">
                        <div class="m-b-md">
                            <i class="fa fa-cloud fa-2x"></i>
                            <h1 class="m-xs"></h1>
                            <h3 class="font-bold no-margins">
                                已消除报警点<h3 class="canceled">{{$result['canceled']}}</h3>
                            </h3>
                            <small>Canceled</small>
                        </div>
                    </div>
<!--                         <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <span class="label label-success pull-right">消除</span>
                                <h5>已消除报警点</h5>
                            </div>
                            <div class="ibox-content">
                                <h1 class="no-margins">36</h1>
                                <div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div>
                                <small>Total income</small>
                            </div>
                        </div> -->
                    </div>
                    <div class="col-lg-3">
                    <div class="widget blue-bg p-md text-center">
                        <div class="m-b-md">
                            <i class="fa fa-shield fa-2x"></i>
                            <h1 class="m-xs"></h1>
                            <h3 class="font-bold no-margins">
                                已确认报警点<h3 class="canceled">{{$result['canceled']}}</h3>
                            </h3>
                            <small>Confirmed</small>
                        </div>
                    </div>
<!--                         <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <span class="label label-info pull-right">确认</span>
                                <h5>已确认报警点</h5>
                            </div>
                            <div class="ibox-content">
                                <h1 class="no-margins">28</h1>
                                <div class="stat-percent font-bold text-info">20% <i class="fa fa-level-up"></i></div>
                                <small>Total income</small>
                            </div>
                        </div> -->
                    </div>
                    <div class="col-lg-3">
                    <div class="widget yellow-bg p-md text-center">
                        <div class="m-b-md">
                            <i class="fa fa-bell fa-2x"></i>
                            <h1 class="m-xs"></h1>
                            <h3 class="font-bold no-margins">
                                未确认报警点<h3 class="alarming">{{$result['alarming']}}</h3>
                            </h3>
                            <small>Unconfirmed</small>
                        </div>
                    </div>
<!--                         <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <span class="label label-warning pull-right">未确认</span>
                                <h5>未确认报警点</h5>
                            </div>
                            <div class="ibox-content">
                                <h1 class="no-margins">12</h1>
                                <div class="stat-percent font-bold text-navy">44% <i class="fa fa-level-up"></i></div>
                                <small>Total income</small>
                            </div>
                        </div> -->
                    </div>
                    <div class="col-lg-3">
                    <div class="widget red-bg p-md text-center">
                        <div class="m-b-md">
                            <i class="fa fa-warning fa-2x"></i>
                            <h1 class="m-xs"></h1>
                            <h3 class="font-bold no-margins">
                                已发起报警点<h3 class="alarming">{{$result['alarming']}}</h3>
                            </h3>
                            <small>Alarming</small>
                        </div>
                    </div>
                        <!-- <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <span class="label label-danger pull-right">发起</span>
                                <h5>已发起报警点</h5>
                            </div>
                            <div class="ibox-content">
                                <h1 class="no-margins">6</h1>
                                <div class="stat-percent font-bold text-danger">38% <i class="fa fa-level-down"></i></div>
                                <small>Total income</small>
                            </div>
                        </div> -->
            </div>
        </div>
<!-- 
        <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>网站访问量统计</h5>
                                <div class="pull-right">
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-xs btn-white active">Today</button>
                                        <button type="button" class="btn btn-xs btn-white">Monthly</button>
                                        <button type="button" class="btn btn-xs btn-white">Annual</button>
                                    </div>
                                </div>
                            </div>
                            <div class="ibox-content">
                                <div class="row">
                                <div class="col-lg-9">
                                    <div class="flot-chart">
                                        <div class="flot-chart-content" id="flot-dashboard-chart"></div>
                                    </div>
                                </div>
                                <div class="col-lg-3">
                                    <ul class="stat-list">
                                        <li>
                                            <h2 class="no-margins">PV：356</h2>
                                            <small>最近一阶段访问总量</small>
                                            <div class="stat-percent">48% <i class="fa fa-level-up text-navy"></i></div>
                                            <div class="progress progress-mini">
                                                <div style="width: 48%;" class="progress-bar"></div>
                                            </div>
                                        </li>
                                        <li>
                                            <h2 class="no-margins ">PV：728</h2>
                                            <small>上一月的总访问量</small>
                                            <div class="stat-percent">60% <i class="fa fa-level-down text-navy"></i></div>
                                            <div class="progress progress-mini">
                                                <div style="width: 60%;" class="progress-bar"></div>
                                            </div>
                                        </li>
                                        <li>
                                            <h2 class="no-margins ">PV：1084</h2>
                                            <small>历史累计访问总数</small>
                                            <div class="stat-percent">22% <i class="fa fa-bolt text-navy"></i></div>
                                            <div class="progress progress-mini">
                                                <div style="width: 22%;" class="progress-bar"></div>
                                            </div>
                                        </li>
                                        </ul>
                                    </div>
                                </div>
                                </div>

                            </div>
                        </div>
        </div> -->

        <div class="row">
<!--                     <div class="col-lg-4">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>回路报警邮件详情</h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="close-link">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <div class="ibox-content ibox-heading">
                                <h3><i class="fa fa-envelope-o"></i> 系统回路报警邮件通知</h3>
                                <small><i class="fa fa-tim"></i> 共计有3封回路报警提示邮件。请注意查收！</small>
                            </div>
                            <div class="ibox-content">
                                <div class="feed-activity-list">

                                    <div class="feed-element">
                                        <div>
                                            <small class="pull-right text-navy">2017-09-08 14:56:48</small>
                                            <strong>1号水泵回路 / jsszzjggac0101004</strong>
                                            <div><h3>实时报警点：<h3 style='color:red;'>jsszzjggac0101004 / 1号水泵回路</h3></h3><br/><h3>报警位置：<h3 style='color:red;'>01电气室</h3></h3><br/>
                <h3>报警类型：<h3 style='color:red;'>电流超越额定值！</h3></h3><br>
                </div>
                                            <small class="text-muted">收件人：xuyiyepeng@qq.com</small>
                                        </div>
                                    </div>

                                    <div class="feed-element">
                                        <div>
                                            <small class="pull-right text-navy">2017-09-08 14:59:02</small>
                                            <strong>除尘风机回路 / jsszzjggac0101003</strong>
                                            <div><h3>实时报警点：<h3 style='color:red;'>jsszzjggac0101003 / 除尘风机回路</h3></h3><br/><h3>报警位置：<h3 style='color:red;'>01电气室</h3></h3><br/>
                <h3>报警类型：<h3 style='color:red;'>电流超越额定值！</h3></h3><br>
                </div>
                                            <small class="text-muted">收件人：xuyiyepeng@qq.com</small>
                                        </div>
                                    </div>

                                    <div class="feed-element">
                                        <div>
                                            <small class="pull-right text-navy">2017-09-13 19:35:52</small>
                                            <strong>2号提升电机回路 / 862815037410311</strong>
                                            <div><h3>实时报警点：<h3 style='color:red;'>862815037410311 / 2号提升电机回路</h3></h3><br/><h3>报警位置：<h3 style='color:red;'>01电气室</h3></h3><br/>
                <h3>报警类型：<h3 style='color:red;'>电流超越额定值！</h3></h3><br>
                </div>
                                            <small class="text-muted">收件人：xuyiyepeng@qq.com</small>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div> -->

        <div class="col-lg-12">

                        <div class="row">
                            <div class="col-lg-4">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h5>系统信息</h5>
                                        <div class="ibox-tools">
                                            <a class="collapse-link">
                                                <i class="fa fa-chevron-up"></i>
                                            </a>
                                            <a class="close-link">
                                                <i class="fa fa-times"></i>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="ibox-content">
                                        <table class="table table-hover no-margins">
                                            <thead>
                                            <tr>
                                                <th>Introduction</th>
                                                <th></th>
                                                <th></th>
                                                <th></th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr>
                                                <td>版本框架：</td>
                                                <td><i class="fa fa-sitemap"></i> Laravel 5.4.30</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td>服务器环境： </td>
                                                <td><i class="fa fa-windows"></i> Nginx 1.9.5</td>
                                                <td>Linux CentOS</td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td>PHP版本：</td>
                                                <td><i class="fa fa-credit-card"></i> 7.1.7</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td><small>Mysql版本：</small> </td>
                                                <td><i class="fa fa-tint"></i> 5.7.18</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td>上传附件限制： </td>
                                                <td><i class="fa fa-warning"></i> 50M</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td>最大执行时间： </td>
                                                <td><i class="fa fa-spinner"></i> 600s</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            <tr>
                                                <td><small>URL支持：</small> </td>
                                                <td><i class="fa fa-unlock"></i> YES</td>
                                                <td></td>
                                                <td class="text-navy"></td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                            </div>
                            <div class="col-lg-4">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-title">
                                        <h5>开发者信息</h5>
                                        <div class="ibox-tools">
                                            <a class="collapse-link">
                                                <i class="fa fa-chevron-up"></i>
                                            </a>
                                            <a class="close-link">
                                                <i class="fa fa-times"></i>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="ibox-content">
                                        <ul class="todo-list m-t small-list">
                                            <li>
                                                <a href="" class="check-link"><i class="fa fa-cubes"></i> </a>
                                                <span class="m-l-xs">程序版本：2.0.0</span>

                                            </li>
                                            <li>
                                                <a href="" class="check-link"><i class="fa fa-user"></i> </a>
                                                <span class="m-l-xs">开发者：JUST计算机协会</span>

                                            </li>
                                            <li>
                                                <a href="" class="check-link"><i class="fa fa-send-o"></i> </a>
                                                <span class="m-l-xs">博客：<a href="https://blog.luckyye.com" target="_Blank">https://blog.luckyye.com</a></span>
                                            </li>
                                            <li>
                                                <a href="" class="check-link"><i class="fa fa-google"></i> </a>
                                                <span class="m-l-xs">邮箱：luckyyinni@gmail.com</span>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                                                        <div class="col-lg-4">
                <div class="ibox float-e-margins">
                <div class="box-header with-border">
                    <h3 class="ibox-title">系统反馈</h3>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" id="form1">
                    {{ csrf_field()}}
                        <input type="hidden" name="status" value="1" />
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标题</label>
                            <div class="col-sm-9"><input class="form-control" name="title" placeholder="标题不可为空" id="title"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">邮箱</label>
                            <div class="col-sm-9"><input class="form-control" name="email" placeholder="邮箱" id="email"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">留言内容</label>
                            <div class="col-sm-9"><textarea class="form-control" style="resize:none;height:150px;" name="content" placeholder="bug发现以及功能优化建议" id="content"></textarea></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"></label>
                            <div class="col-sm-9">
                                <button type="reset" class="btn btn-warning pull-right">重置</button>
                                <button type="button" id="note" class="btn btn-info pull-left submits" >提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
                                </div>
                        </div>
        </div>
    </div>
</div>

<!--         <h3 class="font-bold">This is page content</h3>
        <div class="error-desc">
            You can create here any grid layout you want. And any variation layout you imagine:) Check out
            main dashboard and other site. It use many different layout.
            <br/><a href="index.html" class="btn btn-primary m-t">Dashboard</a>
        </div> -->
    </div>
@endsection
@section('js')
    <!-- Flot -->
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.tooltip.min.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.spline.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.resize.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.pie.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.symbol.js',true))}}"></script>
    <script src="{{asset(getThemeAssets('plugins/jquery.flot.time.js',true))}}"></script>
    <!-- 模态框 -->
    <!-- <script src="{{asset(getThemeAssets('plugins/toastr.min.js',true))}}"></script> -->
    
    <!-- Peity -->
    <!-- <script src="{{asset(getThemeAssets('plugins/jquery.peity.min.js',true))}}"></script> -->
    <!-- <script src="{{asset(getThemeAssets('plugins/peity-demo.js',true))}}"></script>     -->

    <script src="{{asset(getThemeAssets('js/jquery.easypiechart.js'))}}"></script>
    <script type="text/javascript">
        // 留言表单提交触发ajax请求
        $('#note').click(function(event) {
            $.ajaxSetup({
                     headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
            });
            var noteinfo = [];
            noteinfo['title'] = $('#title').val();
            noteinfo['email'] = $('#email').val();
            noteinfo['content'] = $('#content').val();
            // 控制台测试
            // console.log(noteinfo);
            $.ajax({
                url: "{{url ('/admin/home/note')}}",
                type: 'POST',
                // dataType: 'json',
                data: {title: $('#title').val(),email: $('#email').val(),content: $('#content').val()},
                headers: {
                        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                    },
                success: function(res) {
                    if (res['res'] == 1) {
                        alert('success');
                    } else {
                        alert('error');
                    }
                }
            });

            
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function() {
            $(function () {
                // 定时刷新
                setTimeout(function () {
                        alarmnum();
                    },
                    0);
                    //setTimeout 程序执行后200毫秒执行push，但是仅此一次。
                setInterval(function () {
                        alarmnum();
                    },
                    3000);
                // 利用ajax动态加载实时监测信息，实现定时及页面局部刷新
                function alarmnum() {
                    $.ajax({
                        url: "{{url('/admin/home/alarmnum')}}",
                        data: {},
                        type: 'get',
                        datatype: 'json',
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                        },
                        success: function (data) {
                            // alert('response success')
                            // alert(data);
                            // console.log(data);
                            $('.canceled').text(data['canceled']);
                            $('.alarming').text(data['alarming']);
                        }
                    });
                }
            });          
      });

</script>
@endsection